/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package it.coraci.anag.gui.docs;

import it.coraci.anag.db.mongo.entities.Attribute;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 *
 * @author Luca
 */
public class ParamPanel extends javax.swing.JPanel {
    
    public Attribute attribute;

    /**
     * Creates new form ParamPanel
     */
    public ParamPanel() {
        initComponents();
    }

    public ParamPanel(Attribute attribute) {
        initComponents();
        this.attribute = attribute;
        this.jLabel1.setText(attribute.getKey());
        this.jTextField_Value.setText(attribute.getValue());
    }
    
    

    public void setAttribute(Attribute attribute) {
        this.attribute = attribute;
        this.jLabel1.setText(attribute.getKey());
        this.jTextField_Value.setText(attribute.getValue());
    }

    public Attribute getAttribute() {
        attribute.setKey(this.jLabel1.getText());
        attribute.setValue(this.jTextField_Value.getText());
        return attribute;
    }
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jTextField_Value = new javax.swing.JTextField();

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel1.setText("ParamKey:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Value, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
                .addComponent(jTextField_Value, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField jTextField_Value;
    // End of variables declaration//GEN-END:variables
}
